class OrderInfoViewModel:
    def __init__(self, data):
        self.order_number = data.order_number
        self.title = data.title
        self.chars_sum = data.chars_sum
        self.author = data.author
        self.similar_rate = data.similar_rate
        self.finished = data.finished
        self.create_datetime = data.create_datetime
        self.create_time = data.create_time
        self.is_delete = data.is_delete


class OrderInfolistView:
    def __init__(self):
        self.code = 0
        self.remain = 0
        self.msg = ''
        self.data = []

    def fill(self, data, remain):
        self.code = 0
        self.msg = ''
        self.remain = remain if remain else 0
        self.data = [OrderInfoViewModel(item) for item in data]


class OrderInfolistByTokenView:
    def __init__(self):
        self.code = 0
        self.remain = 0
        self.msg = ''
        self.data = []

    def fill(self, data):
        self.code = 0
        self.msg = ''
        self.count = data.total
        self.data = [OrderInfoViewModel(item) for item in data.items]


class OrderInfolistByPageView:
    def __init__(self):
        self.code = 0
        self.remain = 0
        self.msg = ''
        self.data = []

    def fill(self, data, remain):
        self.code = 0
        self.msg = ''
        self.count = data.total
        self.remain = remain if remain else 0
        self.data = [OrderInfoViewModel(item) for item in data.items]
